<template>
	<view class="config—host-container">
		<view class="item">
			<view class="label" >服务器ip：</view>
			<input class="input—value" placeholder="请输入服务器IP地址" v-model="host"/>
		</view>
		<view class="item">
			<view class="label">端口：</view>
			<input class="input—value" v-model="port" placeholder="请输入端口地址"/>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				host:'',
				port:''
			}
		},
		onNavigationBarButtonTap(button) {
			if(button.id == "saveEvent"){
				this.$u.vuex("vuex_host",this.host)
				this.$u.vuex("vuex_port",this.port)
				uni.showToast({
					title:"保存成功",
					icon:"none"
				})
				this.$u.http.setConfig({
					baseUrl:`${this.host? this.host +":" :''}${this.port?this.port:''}`
				})
				uni.navigateBack({
					delta:1
				})
			}
		},
		onLoad() {
			this.host = this.vuex_host;
			this.port = this.vuex_port;
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">

.config—host-container{
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 40rpx;
	.item{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #efefef;
		line-height: 80rpx;
		.label{
			// width: 150rpx;
			color: #3c3c3c;
			font-size: 28rpx;
		}
		.input—value{
			color: #3c3c3c;
			font-size: 28rpx;
			flex:1;
			padding-left: 20rpx;
			border: none;
		}
	}
}
</style>
